package com.dp.vo;

import java.io.Serializable;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;


@Entity
@Table(name = "news_news_question")
//@NamedQueries({@NamedQuery(name = "NewsNewsQuestion.findAll", query = "SELECT n FROM NewsNewsQuestion n"), @NamedQuery(name = "NewsNewsQuestion.findByNewsQuestionPK", query = "SELECT n FROM NewsNewsQuestion n WHERE n.newsQuestionPK.cid = :cid AND n.newsQuestionPK.qid = :qid")})
public class NewsNewsQuestion  implements Serializable{
	private static final long serialVersionUID = 1L;
	@EmbeddedId
    protected NewsNewsQuestionPK newsQuestionPK;                 //问题id
	@JoinColumn(name = "qid", referencedColumnName = "questionid",insertable = false, updatable = false)
	@ManyToOne
	private NewsQuestion newsQuestion;
	
	@JoinColumn(name = "cid", referencedColumnName = "cid",insertable = false, updatable = false)   
	@ManyToOne
    private NewsContenttitle newsContenttitle;     //手机报内容
	
	public NewsNewsQuestion(){
	}
	
	public NewsNewsQuestion(NewsNewsQuestionPK newsQuestionPK) {
        this.newsQuestionPK = newsQuestionPK;
    }

    public NewsNewsQuestion(Integer cid, Integer qid) {
        this.newsQuestionPK = new NewsNewsQuestionPK(cid, qid);
    }
	
	public NewsNewsQuestionPK getNewsQuestionPK() {
		return newsQuestionPK;
	}

	public void setNewsQuestionPK(NewsNewsQuestionPK newsQuestionPK) {
		this.newsQuestionPK = newsQuestionPK;
	}

	public NewsQuestion getNewsQuestion() {
		return newsQuestion;
	}

	public void setNewsQuestion(NewsQuestion newsQuestion) {
		this.newsQuestion = newsQuestion;
	}

	public NewsContenttitle getNewsContenttitle() {
		return newsContenttitle;
	}

	public void setNewsContenttitle(NewsContenttitle newsContenttitle) {
		this.newsContenttitle = newsContenttitle;
	}

	@Override
	public int hashCode() {
	        int hash = 0;
	        hash += (newsQuestionPK != null ? newsQuestionPK.hashCode() : 0);
	        return hash;
	}

    @Override
	public boolean equals(Object object) {
	    if (!(object instanceof NewsNewsQuestion)) {
	          return false;
	     }
	    NewsNewsQuestion other = (NewsNewsQuestion) object;
	     if ((this.newsQuestionPK == null && other.newsQuestionPK != null) || (this.newsQuestionPK != null && !this.newsQuestionPK.equals(other.newsQuestionPK))) {
	         return false;
	     }
	     return true;
	}
	    
	@Override
    public String toString() {
        return "com.dp.vo.NewsNewsQuestion[newsQuestionPK=" + newsQuestionPK + "]";
    }
	
	
}
